<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>企业级Java开发：Nexus私有仓库搭建指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
            background-color: #f8f9fa;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .code-block {
            background-color: #2d2d2d;
            border-radius: 6px;
            color: #f8f8f2;
        }
        .step-icon {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 15px;
            flex-shrink: 0;
        }
        .nav-link {
            position: relative;
            padding-bottom: 5px;
        }
        .nav-link:after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: 0;
            left: 0;
            background-color: #667eea;
            transition: width 0.3s;
        }
        .nav-link:hover:after {
            width: 100%;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="bg-white shadow-sm sticky top-0 z-50">
        <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <span class="text-xl font-bold text-indigo-600">Nexus私服指南</span>
                </div>
                <div class="hidden md:flex items-center space-x-8">
                    <a href="#intro" class="nav-link text-gray-700 hover:text-indigo-600">简介</a>
                    <a href="#install" class="nav-link text-gray-700 hover:text-indigo-600">安装</a>
                    <a href="#config" class="nav-link text-gray-700 hover:text-indigo-600">配置</a>
                    <a href="#manage" class="nav-link text-gray-700 hover:text-indigo-600">管理</a>
                </div>
            </div>
        </div>
    </nav>

    <!-- Hero 区域 -->
    <header class="hero-gradient text-white py-20">
        <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4 leading-tight">企业级Java开发</h1>
                    <h2 class="text-2xl md:text-3xl font-semibold mb-6">Nexus私有仓库搭建指南</h2>
                    <p class="text-lg opacity-90 mb-8">高效管理企业级Java项目依赖，加速构建流程，确保版本稳定性</p>
                    <div class="flex space-x-4">
                        <a href="#intro" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-indigo-50 transition duration-300">开始阅读</a>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/maven/maven-original.svg" alt="Maven" class="w-64 h-64 opacity-90">
                </div>
            </div>
        </div>
    </header>

    <!-- 主要内容 -->
    <main class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- 摘要卡片 -->
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-6">
                    <div class="text-indigo-600 text-2xl mb-4">
                        <i class="fas fa-bolt"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">加速构建</h3>
                    <p class="text-gray-600">通过代理Maven中央仓库，显著减少依赖下载时间，提高开发效率</p>
                </div>
            </div>
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-6">
                    <div class="text-indigo-600 text-2xl mb-4">
                        <i class="fas fa-lock"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">版本控制</h3>
                    <p class="text-gray-600">统一管理企业内部组件版本，避免依赖冲突和不兼容问题</p>
                </div>
            </div>
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-6">
                    <div class="text-indigo-600 text-2xl mb-4">
                        <i class="fas fa-network-wired"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">统一管理</h3>
                    <p class="text-gray-600">集中化管理所有依赖，包括第三方库和企业自研组件</p>
                </div>
            </div>
        </div>

        <!-- 简介部分 -->
        <section id="intro" class="mb-20">
            <div class="flex items-center mb-8">
                <span class="step-icon">
                    <i class="fas fa-info-circle"></i>
                </span>
                <h2 class="text-3xl font-bold text-gray-800">1. Nexus 简介</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
                <p class="mb-6 text-gray-700 leading-relaxed">
                    在企业级 Java 开发中，项目通常需要依赖大量第三方库和内部私有组件。直接使用 Maven 中央仓库可能存在网络延迟、版本不稳定等问题，而将所有依赖都打包进项目也不现实。因此，企业通常会搭建私有 Maven 仓库，既可以加速构建，又能管理自研组件。Nexus Repository Manager 是最常用的 Maven 私服之一。
                </p>
                <div class="flex flex-wrap gap-4">
                    <span class="bg-indigo-100 text-indigo-800 px-3 py-1 rounded-full text-sm font-medium">Maven</span>
                    <span class="bg-indigo-100 text-indigo-800 px-3 py-1 rounded-full text-sm font-medium">npm</span>
                    <span class="bg-indigo-100 text-indigo-800 px-3 py-1 rounded-full text-sm font-medium">Docker</span>
                </div>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">主要功能</h3>
                    <ul class="space-y-3">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>代理 Maven 中央仓库，加速构建</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>存储企业内部的私有依赖，确保稳定性</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>统一管理不同版本的构件，避免版本混乱</span>
                        </li>
                    </ul>
                </div>
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">Nexus版本</h3>
                    <div class="space-y-4">
                        <div>
                            <div class="flex justify-between mb-1">
                                <span class="font-medium">Nexus OSS (开源版)</span>
                                <span class="text-green-600 font-medium">免费</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div class="bg-indigo-600 h-2.5 rounded-full" style="width: 80%"></div>
                            </div>
                            <p class="text-sm text-gray-500 mt-1">适合中小企业和个人开发者</p>
                        </div>
                        <div>
                            <div class="flex justify-between mb-1">
                                <span class="font-medium">Nexus Pro (专业版)</span>
                                <span class="text-purple-600 font-medium">收费</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div class="bg-purple-600 h-2.5 rounded-full" style="width: 100%"></div>
                            </div>
                            <p class="text-sm text-gray-500 mt-1">适合大型企业，提供高级功能</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 安装部分 -->
        <section id="install" class="mb-20">
            <div class="flex items-center mb-8">
                <span class="step-icon">
                    <i class="fas fa-download"></i>
                </span>
                <h2 class="text-3xl font-bold text-gray-800">2. 安装 Nexus Repository Manager</h2>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">2.1 下载 Nexus</h3>
                    <p class="mb-4 text-gray-700">Nexus 提供了开源版 OSS（免费）和专业版（收费）。这里我们使用 <strong>Nexus OSS</strong>。</p>
                    <ul class="space-y-2 mb-4">
                        <li class="flex items-start">
                            <i class="fas fa-link text-indigo-500 mt-1 mr-2"></i>
                            <span>官方下载地址：<a href="https://www.sonatype.com/products/nexus-repository" class="text-indigo-600 hover:underline" target="_blank">https://www.sonatype.com/products/nexus-repository</a></span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-desktop text-indigo-500 mt-1 mr-2"></i>
                            <span>选择适合的操作系统版本，并下载 ZIP 包</span>
                        </li>
                    </ul>
                    <div class="relative rounded-lg overflow-hidden">
                        <div class="code-block p-4">
                            <span class="text-gray-400"># 下载示例</span><br>
                            <span class="text-blue-300">wget</span> <span class="text-green-300">https://download.sonatype.com/nexus/3/latest-unix.tar.gz</span><br>
                            <span class="text-blue-300">tar</span> <span class="text-yellow-300">-xvf</span> latest-unix.tar.gz
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">2.2 启动 Nexus</h3>
                    <p class="mb-4 text-gray-700">解压下载的 ZIP 文件后，进入 <code class="bg-gray-100 px-2 py-1 rounded">nexus/bin</code> 目录：</p>
                    <div class="relative rounded-lg overflow-hidden mb-4">
                        <div class="code-block p-4">
                            <span class="text-gray-400"># Linux/Mac</span><br>
                            <span class="text-blue-300">./nexus</span> <span class="text-yellow-300">start</span><br><br>
                            <span class="text-gray-400"># Windows</span><br>
                            <span class="text-blue-300">nexus.exe</span> <span class="text-yellow-300">/run</span>
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <p class="text-gray-700">默认情况下，Nexus 运行在 <a href="http://localhost:8081" class="text-indigo-600 hover:underline" target="_blank">http://localhost:8081</a>。</p>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mt-6 card-hover">
                <h3 class="text-xl font-semibold mb-4 text-indigo-600">2.3 配置管理员账户</h3>
                <p class="mb-4 text-gray-700">首次启动后，访问 <code class="bg-gray-100 px-2 py-1 rounded">http://localhost:8081</code>，默认的管理员账户信息：</p>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div class="bg-gray-50 p-4 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-user text-indigo-500 mr-2"></i>
                            <span class="font-medium">用户名</span>
                        </div>
                        <div class="bg-white p-2 rounded border border-gray-200">
                            admin
                        </div>
                    </div>
                    <div class="bg-gray-50 p-4 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-key text-indigo-500 mr-2"></i>
                            <span class="font-medium">密码</span>
                        </div>
                        <div class="bg-white p-2 rounded border border-gray-200">
                            &lt;nexus-data&gt;/admin.password 文件内的内容
                        </div>
                    </div>
                </div>
                <p class="mt-4 text-gray-700">登录后，可以修改密码，并进行后续配置。</p>
            </div>
        </section>

        <!-- 配置部分 -->
        <section id="config" class="mb-20">
            <div class="flex items-center mb-8">
                <span class="step-icon">
                    <i class="fas fa-cog"></i>
                </span>
                <h2 class="text-3xl font-bold text-gray-800">3. 配置 Maven 私有仓库</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8 card-hover">
                <h3 class="text-xl font-semibold mb-4 text-indigo-600">Nexus中的仓库类型</h3>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="border border-gray-200 rounded-lg p-4">
                        <div class="flex items-center mb-3">
                            <div class="w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-exchange-alt text-blue-600"></i>
                            </div>
                            <h4 class="font-semibold">Proxy（代理仓库）</h4>
                        </div>
                        <p class="text-gray-600">代理远程仓库，加速访问</p>
                    </div>
                    <div class="border border-gray-200 rounded-lg p-4">
                        <div class="flex items-center mb-3">
                            <div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-database text-purple-600"></i>
                            </div>
                            <h4 class="font-semibold">Hosted（宿主仓库）</h4>
                        </div>
                        <p class="text-gray-600">存储企业私有构件</p>
                    </div>
                    <div class="border border-gray-200 rounded-lg p-4">
                        <div class="flex items-center mb-3">
                            <div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-layer-group text-green-600"></i>
                            </div>
                            <h4 class="font-semibold">Group（仓库组）</h4>
                        </div>
                        <p class="text-gray-600">合并多个仓库，提供统一访问入口</p>
                    </div>
                </div>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">3.1 创建私有宿主仓库</h3>
                    <ol class="space-y-4">
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">1</span>
                            <span>登录 Nexus 后，进入 <strong>"Repositories"</strong></span>
                        </li>
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">2</span>
                            <span>点击 <strong>"Create repository"</strong>，选择 <strong>maven2 (hosted)</strong></span>
                        </li>
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">3</span>
                            <span>设置仓库名称，例如 <code class="bg-gray-100 px-1 rounded">maven-private</code></span>
                        </li>
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">4</span>
                            <span>选择 <strong>Release</strong> 作为策略（Snapshot 用于快照版本）</span>
                        </li>
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">5</span>
                            <span>点击 <strong>Create repository</strong></span>
                        </li>
                    </ol>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">3.2 配置代理仓库</h3>
                    <div class="mb-4">
                        <p class="text-gray-700 mb-2">为中央仓库加速配置代理：</p>
                        <ol class="space-y-3">
                            <li class="flex items-start">
                                <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">1</span>
                                <span>进入 <strong>Repositories</strong>，创建 <strong>maven2 (proxy)</strong></span>
                            </li>
                            <li class="flex items-start">
                                <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">2</span>
                                <span>配置 <code class="bg-gray-100 px-1 rounded">Remote storage</code> 为 <code class="bg-gray-100 px-1 rounded">https://repo1.maven.org/maven2/</code></span>
                            </li>
                            <li class="flex items-start">
                                <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">3</span>
                                <span>选择 <strong>"Allow Redeploy"</strong> 以允许重新上传</span>
                            </li>
                            <li class="flex items-start">
                                <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">4</span>
                                <span>点击 <strong>Create repository</strong></span>
                            </li>
                        </ol>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">3.3 创建仓库组</h3>
                    <p class="text-gray-700 mb-4">创建统一访问入口，合并多个仓库：</p>
                    <ol class="space-y-3">
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">1</span>
                            <span>创建 <strong>maven2 (group)</strong> 仓库</span>
                        </li>
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">2</span>
                            <span>添加 <code class="bg-gray-100 px-1 rounded">maven-private</code> 和 <code class="bg-gray-100 px-1 rounded">maven-central</code>（代理仓库）</span>
                        </li>
                        <li class="flex items-start">
                            <span class="bg-indigo-100 text-indigo-800 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">3</span>
                            <span>这样，所有 Maven 请求都可通过单一 URL 访问</span>
                        </li>
                    </ol>
                    <div class="mt-6 bg-indigo-50 p-4 rounded-lg">
                        <div class="flex items-center text-indigo-700">
                            <i class="fas fa-info-circle mr-2"></i>
                            <span class="font-medium">统一访问URL示例：</span>
                        </div>
                        <div class="mt-2 bg-white p-2 rounded border border-indigo-100 text-sm">
                            http://localhost:8081/repository/maven-group/
                        </div>
                    </div>
                </div>
            </div>

            <div class="mt-8 grid grid-cols-1 gap-6">
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">4.1 修改 settings.xml</h3>
                    <p class="mb-4 text-gray-700">编辑 <code class="bg-gray-100 px-1 rounded">~/.m2/settings.xml</code>（Windows 下为 <code class="bg-gray-100 px-1 rounded">C:\Users\你的用户名\.m2\settings.xml</code>），添加私服配置：</p>
                    <div class="relative rounded-lg overflow-hidden mb-4">
                        <div class="code-block p-4">
                            <span class="text-gray-400">&lt;!-- 配置Maven使用Nexus私服 --&gt;</span><br>
                            <span class="text-blue-300">&lt;mirrors&gt;</span><br>
                            &nbsp;&nbsp;<span class="text-blue-300">&lt;mirror&gt;</span><br>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-300">&lt;id&gt;</span>nexus-mirror<span class="text-blue-300">&lt;/id&gt;</span><br>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-300">&lt;mirrorOf&gt;</span>*<span class="text-blue-300">&lt;/mirrorOf&gt;</span><br>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-300">&lt;url&gt;</span>http://localhost:8081/repository/maven-group/<span class="text-blue-300">&lt;/url&gt;</span><br>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-300">&lt;layout&gt;</span>default<span class="text-blue-300">&lt;/layout&gt;</span><br>
                            &nbsp;&nbsp;<span class="text-blue-300">&lt;/mirror&gt;</span><br>
                            <span class="text-blue-300">&lt;/mirrors&gt;</span>
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <p class="text-gray-700">这样，所有 Maven 依赖都会优先从 Nexus 下载。</p>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">4.2 上传私有组件</h3>
                    <p class="mb-4 text-gray-700">在 <code class="bg-gray-100 px-1 rounded">pom.xml</code> 中添加 Nexus 发布配置：</p>
                    <div class="relative rounded-lg overflow-hidden mb-4">
                        <div class="code-block p-4">
                            <span class="text-gray-400">&lt;!-- 配置项目发布到Nexus --&gt;</span><br>
                            <span class="text-blue-300">&lt;distributionManagement&gt;</span><br>
                            &nbsp;&nbsp;<span class="text-blue-300">&lt;repository&gt;</span><br>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-300">&lt;id&gt;</span>nexus<span class="text-blue-300">&lt;/id&gt;</span><br>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-300">&lt;url&gt;</span>http://localhost:8081/repository/maven-private/<span class="text-blue-300">&lt;/url&gt;</span><br>
                            &nbsp;&nbsp;<span class="text-blue-300">&lt;/repository&gt;</span><br>
                            <span class="text-blue-300">&lt;/distributionManagement&gt;</span>
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <p class="mb-4 text-gray-700">然后使用 <code class="bg-gray-100 px-1 rounded">deploy</code> 命令上传构件：</p>
                    <div class="relative rounded-lg overflow-hidden">
                        <div class="code-block p-4">
                            <span class="text-blue-300">mvn</span> <span class="text-yellow-300">clean</span> <span class="text-yellow-300">deploy</span> -DskipTests
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <p class="mt-4 text-gray-700">这样，项目的 JAR 包会上传到 Nexus 私服，供其他团队成员使用。</p>
                </div>
            </div>
        </section>

        <!-- 管理部分 -->
        <section id="manage">
            <div class="flex items-center mb-8">
                <span class="step-icon">
                    <i class="fas fa-tasks"></i>
                </span>
                <h2 class="text-3xl font-bold text-gray-800">5. 管理和维护 Nexus</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">5.1 清理旧版本依赖</h3>
                    <p class="mb-4 text-gray-700">随着时间推移，Nexus 仓库会存储大量旧版本，导致磁盘空间占用过大。可以在 Nexus 的 <strong>Tasks</strong> 里创建 <strong>Cleanup policies</strong>，定期删除老版本。</p>
                    <div class="bg-yellow-50 p-4 rounded-lg border border-yellow-200">
                        <div class="flex items-start">
                            <i class="fas fa-exclamation-triangle text-yellow-500 mt-1 mr-2"></i>
                            <div>
                                <p class="font-medium text-yellow-700">注意事项</p>
                                <p class="text-yellow-600 mt-1">设置清理策略时，确保保留足够的版本供历史项目使用，一般建议保留最近3-5个版本。</p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">5.2 备份与恢复</h3>
                    <p class="mb-4 text-gray-700">企业级应用需要定期备份 Nexus 数据：</p>
                    <div class="relative rounded-lg overflow-hidden mb-4">
                        <div class="code-block p-4">
                            <span class="text-gray-400"># 备份Nexus数据</span><br>
                            <span class="text-blue-300">cp</span> <span class="text-yellow-300">-r</span> /opt/nexus-data /backup/nexus-data-$(date +%F)
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <p class="mb-4 text-gray-700">如果 Nexus 崩溃，可以从备份恢复：</p>
                    <div class="relative rounded-lg overflow-hidden">
                        <div class="code-block p-4">
                            <span class="text-gray-400"># 从备份恢复Nexus</span><br>
                            <span class="text-blue-300">rm</span> <span class="text-yellow-300">-rf</span> /opt/nexus-data<br>
                            <span class="text-blue-300">cp</span> <span class="text-yellow-300">-r</span> /backup/nexus-data-最新日期 /opt/nexus-data<br>
                            <span class="text-blue-300">./nexus</span> <span class="text-yellow-300">start</span>
                        </div>
                        <button class="absolute top-2 right-2 text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <p class="text-sm">技术小馆</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-sm hover:text-white transition duration-300" target="_blank">http://www.yuque.com/jtostring</a>
                </div>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        // 初始化Mermaid图表
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // 复制代码块功能
        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('.code-block + button').forEach(button => {
                button.addEventListener('click', function() {
                    const codeBlock = this.previousElementSibling;
                    const range = document.createRange();
                    range.selectNode(codeBlock);
                    window.getSelection().removeAllRanges();
                    window.getSelection().addRange(range);
                    document.execCommand('copy');
                    window.getSelection().removeAllRanges();
                    
                    const originalIcon = this.innerHTML;
                    this.innerHTML = '<i class="fas fa-check"></i>';
                    setTimeout(() => {
                        this.innerHTML = originalIcon;
                    }, 2000);
                });
            });
        });
    </script>
</body>
</html>